<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <title>公司通用模板设置</title>
</head>

<body>
  <div id="app" v-loading.fullscreen.lock="loading">
    <div class="template-setting">
      <el-tabs v-if="menus!==null" v-model="activeMenu" class="dorm-mgr-tabs full-tabs">
        <el-tab-pane v-for="menu in menus" :key="menu.name" :label="menu.label" :name="menu.name">
          <component v-if="activeMenu===menu.name" :is="menu.url" class="menu-item" :user="user"></component>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</body>

<script src="https://upload.shinehao.com.cn/20181222140744qiniu.min.js"></script>
<script src="../../myJs/importFile.js"></script>
<script>
  importFile([
    "/vueSystem/components/css/richEditor.css",
    "/vueSystem/components/css/formGroup.css",
    "../components/css/tableColumnSetting.css",
    "./css/orderTemplateSetting.css"
  ], [
    "/vueSystem/i18n/index.js",
    "/vueSystem/js/checkVaildUtil.js",
    "/vueSystem/models/baseModel.js",
    "/static/jquery-ui/jquery-ui.min.js",
    "/vueSystem/components/config/templateColumnConfig.js",
    "/vueSystem/components/formGroup.js",
    "/vueSystem/models/templateConfig.js",
    "/vueSystem/js/commonTemplateUtil.js"
  ]);
  importRichEditorFiles([
    "/vueSystem/components/richEditor.js"
  ]);

</script>
<script src="../models/proOrderTemplateConfig.js"></script>
<script src="../mixins/templateSettingMixin.js"></script>
<script src="../components/fontSizeInput.js"></script>
<script src="../components/tableColumnSetting.js"></script>
<script src="./orderTemplateSetting.js"></script>
<script src="./purchaseTemplate.js"></script>
<script src="./prePurchaseTemplate.js"></script>
<script src="./warehouseOutTemplate.js"></script>
<script src="./warehouseInTemplate.js"></script>
<script src="./outOrderTemplate.js"></script>
<script src="./issueOrderTemplate.js"></script>
<script src="./returnOrderTemplate.js"></script>
<script src="./proOrderTemplate.js"></script>

<script>
  var app = new Vue({
    el: '#app',
    data: function () {
      return {
        loading: false,
        activeMenu: 'purchaseTemplate',
        menus: null,
        user: null
      };
    },

    created: function () {
      this.initMenu();
    },

    methods: {
      initMenu: function () {
        var self = this;
        var allMenus = [{
          label: '采购单模板',
          name: 'purchaseTemplate',
          url: 'purchase-template'
        }, {
          label: '预采购单模板',
          name: 'prePurchaseTemplate',
          url: 'pre-purchase-template',
          hasCheck: true
        }, {
          label: '出库单模板',
          name: 'warehouseOutTemplate',
          url: 'warehouse-out-template'
        }, {
          label: '入库单模板',
          name: 'warehouseInTemplate',
          url: 'warehouse-in-template'
        }, {
          label: '外协单模板',
          name: 'outOrderTemplate',
          url: 'out-order-template',
          hasCheck: true
        }, {
          label: '发料单模板',
          name: 'issueOrderTemplate',
          url: 'issue-order-template'
        }, {
          label: '退货单模板',
          name: 'returnOrderTemplate',
          url: 'return-order-template'
        }, {
          label: '制单模板',
          name: 'proOrderTemplate',
          url: 'pro-order-template'
        }];

        this.loading = true;
        var self = this;
        SysUtil.getUser().then(function (user) {
          var isPayUser = user.companyInfo.status === 1;
          self.user = user;

          var menus = [];
          for (var i = 0; i < allMenus.length; i++) {
            var allMenu = allMenus[i];
            if (allMenu.hasCheck && !isPayUser) {
              continue;
            }
            menus.push(allMenu);
          }
          self.menus = menus;
          self.loading = false;
        }).catch(function () {
          self.loading = false;
        });
      }
    },

    components: {
      PurchaseTemplate: PurchaseTemplate,
      PrePurchaseTemplate: PrePurchaseTemplate,
      WarehouseOutTemplate: WarehouseOutTemplate,
      WarehouseInTemplate: WarehouseInTemplate,
      OutOrderTemplate: OutOrderTemplate,
      IssueOrderTemplate: IssueOrderTemplate,
      ReturnOrderTemplate: ReturnOrderTemplate,
      ProOrderTemplate: ProOrderTemplate
    }
  });

</script>
<style>
  .template-setting {
    padding-left: 20px;
    height: 100%;
  }

  .template-setting .menu-item {
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 20px;
    height: calc(100% - 10px);
    overflow: auto;
    position: relative;
  }

</style>

</html>
